package com.itany.corejava.code10_异常;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 石小俊
 * 2024年07月26日 10:03
 */
public class Test06_异常的定位与解决 {
    public static void main(String[] args) throws DateConverterException {
        C c = new C();
        c.c();
    }
}

class C {
    public void c() throws DateConverterException {
        System.out.println("C.c");
        D d = new D();
        d.d();
    }
}

class D {
    public void d() throws DateConverterException {
        System.out.println("D.d");
        E e = new E();
        try {
            e.e();
        } catch (ParseException e1) {
            e1.printStackTrace();
            throw new DateConverterException("日期转换出现了问题,异常原因:" + e1.getMessage());
        }

    }
}

class E {
    public void e() throws ParseException {
        System.out.println("E.e");
        Date date = new SimpleDateFormat("yyyy-MM-dd").parse("2024-02-04");
        System.out.println(date);
    }
}
